requestdeactivation

SoftwareShield ClientProtector COM Component > ClientProtector (SSCProtector) Reference > RequestDeactivation

## RequestDeactivation

The RequestDeactivation function attempts to deactivate the currently loaded license. The function may cause the OnAttemptDeactivate event to fire, allowing you to give the user a final chance to abort the deactivation operation immediately before it completes. RequestDeactivation is useful when you wish to ensure that license is rendered completely deactivated.

Note this is different than "Checking-In" a Serial Number which may deactivate an aspect of a license - not the entire thing.

###### Syntax

HRESULT RequestDeactivation ( BSTR * DeactivationConfirmationCode, long * return_code );

###### Parameters

DeactivationConfirmationCode

[OUT] Wide character string that returns with the Deactivation Confirmation Code, verifying that the license has been deactivated. Note: May be empty if the operation fails (see remarks below).

return_code

[OUT] This is (a pointer to) a numeric value that returns with a RETURNCODE that identifies the outcome of the operation.

###### Remarks

Note: This function is illustrated in the SoftwareShield Flowcharts - (see flow chart #2).

If the license has not been initialized successfully with a call to StartUp, the function will return with return_code holding FALSE_LICENSE_NOT_INITIALIZED.

If the license does not have a Deactivation Authorization Definition, the function returns immediately with return_code holding FALSE_NO_DEACTIVATE_ID.

If the license does contain a Deactivation Authorization Definition, but its pre-condition has not been met, the function returns immediately with return_code holding FALSE_PRECONDITION_NOT_MET.

If the license does contain have a Deactivation Authorization Definition, and its pre-condition has been met (if any), the function fires the OnAttemptDeactivate event. If your event handler sets the AllowDeactivate parameter from that event handler to false, the function will return with return_code holding FALSE_REFUSE_TO_DEACTIVATE. (See OnAttemptDeactivate for more information.)

If the license does contain a Deactivation Authorization Definition, and its pre-condition has been met (if any), and you have no event handler connected, or your event handler sets the AllowDeactivate parameter from that event handler to true, the function will deactivate the license and return with return_code holding FALSE_LICENSE_DEACTIVATED. This indicates that the license has now been permanently deactivated.

When successful (return_code holding FALSE_LICENSE_DEACTIVATED) the DeactivationConfirmationCode parameter will return holding the code which confirms that the license has indeed been deactivated. This code is in the exact same format as an Authorization Request Code and can be input into the Manual-Activator by the vendor to ensure that the license was deactivated (before issuing a new Activation Code for example when a user wishes to move a machine locked license).

Also, when successful, the function causes the deactivation confirmation code to be written to disk to the application directory in a text file named: "DEACTIVATION_LOG.txt". This allows you to ensure that even if the client quickly dismisses any confirmation code you provide in a dialog, that the code can be retrieved later.

The DeactivationConfirmationCode parameter should be ignored unless the return_code returns holding FALSE_LICENSE_DEACTIVATED. It will be empty otherwise.

###### Return Value

As with all COM function calls they return an HRESULT. HRESULT is a data type that is a 32-bit error or warning code. Check your compilers documentation for information on interpreting the HRESULT value.

###### Function Information

Exposed By Interface: | "ISSCProtector"
Exposed In COM Server Binaries: | "SSCProt.dll" and "SSCProtD.dll"